function commentcheck() {
  document.getElementById("commentpreview_message").innerHTML = commentpee(document.getElementById("comment").value);
  if (document.getElementById("url").value) {
    document.getElementById("commentpreview_author").innerHTML = "<a>"+document.getElementById("author").value+"<\/a>";
  } else {
    document.getElementById("commentpreview_author").innerHTML = document.getElementById("author").value;
  }
  document.getElementById("commentpreview_gravatar").src = gravatar(document.getElementById("email").value);
}
function commentpee(topee) {
  var br = /\
/g;
  var pee = /\
\
/g;
  var poo = /<p><br \/><\/p>/g;
  var poopee = /\
\
\
/g;
  var topee1 = topee.replace(poopee,pee);
  var topee2 = topee1.replace(pee,"<\/p><p>");
  var topee3 = "<p>"+topee2.replace(br,"<br \/>")+"<\/p>";
  var peed = topee3.replace(poo,"");
  return peed;
}
function gravatar(email) {
  return "http://www.gravatar.com/avatar.php?gravatar_id="+hex_md5(email.toLowerCase())+"&amp;size=48&amp;default="+defaultgravatar;
}